/**
 * 剑指 Offer 64. 求1+2+…+n
 * https://leetcode-cn.com/problems/qiu-12n-lcof/
 */

/**
 * @param {number} n
 * @return {number}
 */
function sumNums(n) {
  return ((1 + n) * n) / 2;
}

console.log(sumNums(3) === 6);
console.log(sumNums(9) === 45);
